home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group03a.txt / 000045_icon-group-sender_Tue Mar 25 17:16:41 2003.msg < prev    next >
Internet Message Format  |  2003-12-22  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id h2Q0GRI19505
  4.     for icon-group-addresses; Tue, 25 Mar 2003 17:16:27 -0700 (MST)
  5. Message-Id: <200303260016.h2Q0GRI19505@baskerville.CS.Arizona.EDU>
  6. From: ernobe <ernobe@yahoo.com>
  7. X-Newsgroups: comp.lang.icon
  8. Subject: Re: newbie question -- ressurected
  9. Date: Tue, 25 Mar 2003 14:29:39 -0600
  10. User-Agent: Noworyta News Reader/2.9
  11. To: icon-group@cs.arizona.edu
  12. Errors-To: icon-group-errors@cs.arizona.edu
  13. Status: RO
  14.  
  15. Quiet Voice wrote:
  16.  
  17. > Greetings:
  18. > Several years ago, I made a brief foray into trying to teach myself
  19. > the ICON programming language and develop some text analysis software.
  20. > After several fits-n-starts, the project sort of died on the vine.
  21. > I'm back at it again. Now, I'm trying to dig thru past code, remind
  22. > myself of what it was supposed to do and how...and shake out the
  23. > kinks.
  24. > I ran a piece of code this morning and discovered that it results in
  25. > an infinite loop.....but I can't figure out why.
  26. > here is the code fragment:
  27. > while not((line := read(data)) == "") do every
  28. > write(lettercount[!line] +:= 1)
  29. > {Note, this is one continuous line in the actual code}
  30. > "data" is an input text file
  31. > From some debugging I've done, it seems like it keep reading from the
  32. > file after it reaches the end...it just loops back to the begining of
  33. > the file and starts over again. But I don't figure out why.
  34. > What am I missing?
  35. According the Icon Language Reference, read( f ) "Produces the next line
  36. from f, but fails on end of file." 
  37.    Therefore, when the read function fails at the end of the data file,
  38. a new assignment is not made to the line variable, the not function
  39. succeeds once again, and an infinite loop ensues.
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54. -- 
  55. my esoteric links:
  56. http://www.costarricense.cr/pagina/ernobe
  57. take my quiz:
  58. http://www.quizyourfriends.com/yourquiz.php?quizname=030320115851-ernobe
  59.